<template>
	<div>
		<v-button theme="primary" size="small" @click="edit">更新</v-button>
		<v-button theme="warning" size="small" @click="reset">重置密码</v-button>
		<v-button theme="danger" size="small" @click="remove">删除</v-button>
	</div>
</template>

<script>
	export default {
		data: () => ({
			id: 0,
			name:"",
			model: {},
			bid:0
		}),
		methods: {
		    reload() {
					this.$dispatch("reload");
				},
			  edit() {
					this.$dispatch("edit");
				},
				reset() {
					let self = this;
					let data = {
						title: "重置密码操作",
						content: "您是否要重置操作员" + self.name + "的密码?"
					}
					Midway.confirm(data).then(function () {
						let _data = {
							oprId: self.id
							// brhId: self.bid
						}
						console.log(_data);
						self.$post({
							url: "/api/v1" + projectName_Url + "/plat/opr/resetPwd/"+_data.oprId,
							data: _data,
							method:"PUT"
						}).then( response => {
							let message = {
								title:"操作提示",
								content:"重置用户"+self.name+"密码成功"
							}
						  Midway.alert(message);
							self.reload();

						},error => {});
					})
				},
				remove() {
					let self = this;
					let data = {
						title: "删除操作",
						content: "您是否要删除操作员" + self.name + "?"
					}
					Midway.confirm(data).then(function () {
						let _data = {
							oprId: self.id,
							mchtId:self.mchtId
							// brhId: self.bid
						}
						self.$post({
							url: "/api/v1" + projectName_Url + "/plat/opr/"+_data.oprId/+_data.mchtId,
							data: _data,
							method:"DELETE"
						}).then(function (response) {
							let message = {
								title:"操作提示",
								content:"删除用户"+self.name+"成功"
							}
							Midway.alert(message);
							self.reload();
						});
					})

				}
		}
	}
</script>
